|
spitoi2c 2.2.0
|
API for configuring and manipulating SPI to I2C Click driver. More...
Topics | |
| SPI to I2C Registers List | |
| List of registers of SPI to I2C Click driver. | |
| SPI to I2C Registers Settings | |
| Settings for registers of SPI to I2C Click driver. | |
| SPI to I2C MikroBUS Map | |
| MikroBUS pin mapping of SPI to I2C Click driver. | |
Functions | |
| void | spitoi2c_cfg_setup (spitoi2c_cfg_t *cfg) |
| SPI to I2C configuration object setup function. | |
| err_t | spitoi2c_init (spitoi2c_t *ctx, spitoi2c_cfg_t *cfg) |
| SPI to I2C initialization function. | |
| err_t | spitoi2c_default_cfg (spitoi2c_t *ctx) |
| SPI to I2C default configuration function. | |
| err_t | spitoi2c_gpio_write (spitoi2c_t *ctx, uint8_t gpio_data) |
| SPI to I2C gpio write function. | |
| err_t | spitoi2c_gpio_read (spitoi2c_t *ctx, uint8_t *gpio_data) |
| SPI to I2C gpio read function. | |
| err_t | spitoi2c_gpio_config (spitoi2c_t *ctx, uint8_t direction, uint8_t pin_mask) |
| SPI to I2C gpio gpio config function. | |
| err_t | spitoi2c_read_i2c_status (spitoi2c_t *ctx, uint8_t *i2c_stat) |
| SPI to I2C read i2c status function. | |
| err_t | spitoi2c_i2c_write (spitoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t len) |
| SPI to I2C i2c write function. | |
| err_t | spitoi2c_i2c_read (spitoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_out, uint8_t len) |
| SPI to I2C i2c read function. | |
| err_t | spitoi2c_i2c_read_after_write (spitoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint8_t out_len) |
| SPI to I2C i2c read after write function. | |
| err_t | spitoi2c_i2c_write_after_write (spitoi2c_t *ctx, uint8_t slave_addr, uint8_t *data_in1, uint8_t in1_len, uint8_t *data_in2, uint8_t in2_len) |
| SPI to I2C i2c write after write function. | |
| void | spitoi2c_read_buffer (spitoi2c_t *ctx, uint8_t *data_out, uint8_t len) |
| SPI to I2C read buffer function. | |
| err_t | spitoi2c_set_spi_config (spitoi2c_t *ctx, uint8_t spi_cfg) |
| SPI to I2C set spi config function. | |
| err_t | spitoi2c_write_register (spitoi2c_t *ctx, uint8_t reg, uint8_t data_in) |
| SPI to I2C write register function. | |
| err_t | spitoi2c_read_register (spitoi2c_t *ctx, uint8_t reg, uint8_t *data_out) |
| SPI to I2C read register function. | |
| void | spitoi2c_deep_power_down (spitoi2c_t *ctx) |
| SPI to I2C deep power down function. | |
| void | spitoi2c_wake_up (spitoi2c_t *ctx) |
| SPI to I2C wake up function. | |
| err_t | spitoi2c_read_version (spitoi2c_t *ctx, uint8_t *version) |
| SPI to I2C read version function. | |
| void | spitoi2c_enable_device (spitoi2c_t *ctx) |
| SPI to I2C enable device function. | |
| void | spitoi2c_disable_device (spitoi2c_t *ctx) |
| SPI to I2C disable device function. | |
| uint8_t | spitoi2c_get_int_pin (spitoi2c_t *ctx) |
| SPI to I2C get int pin function. | |
API for configuring and manipulating SPI to I2C Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void spitoi2c_cfg_setup | ( | spitoi2c_cfg_t * | cfg | ) |
SPI to I2C configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See spitoi2c_cfg_t object definition for detailed explanation. |
| void spitoi2c_deep_power_down | ( | spitoi2c_t * | ctx | ) |
SPI to I2C deep power down function.
This function performs a deep power down command.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| err_t spitoi2c_default_cfg | ( | spitoi2c_t * | ctx | ) |
SPI to I2C default configuration function.
This function executes a default configuration of SPI to I2C Click board.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void spitoi2c_disable_device | ( | spitoi2c_t * | ctx | ) |
SPI to I2C disable device function.
This function disables the device by setting the RST pin to low logic state.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| void spitoi2c_enable_device | ( | spitoi2c_t * | ctx | ) |
SPI to I2C enable device function.
This function enables the device by setting the RST pin to high logic state.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| uint8_t spitoi2c_get_int_pin | ( | spitoi2c_t * | ctx | ) |
SPI to I2C get int pin function.
This function returns the INT pin logic state.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| err_t spitoi2c_gpio_config | ( | spitoi2c_t * | ctx, |
| uint8_t | direction, | ||
| uint8_t | pin_mask ) |
SPI to I2C gpio gpio config function.
This function sets the gpio direction config for the selected pins.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | direction | : GPIO direction:
|
| [in] | pin_mask | : Mask for pins to configure (only GPIO0-GPIO3 are configurable, GPIO4 is input only). |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_gpio_read | ( | spitoi2c_t * | ctx, |
| uint8_t * | gpio_data ) |
SPI to I2C gpio read function.
This function reads data from the gpio port.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [out] | gpio_data | : GPIO data read. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_gpio_write | ( | spitoi2c_t * | ctx, |
| uint8_t | gpio_data ) |
SPI to I2C gpio write function.
This function writes a desired data to the gpio port.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | gpio_data | : GPIO data to be written (only GPIO0-GPIO3 are writable). |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_i2c_read | ( | spitoi2c_t * | ctx, |
| uint8_t | slave_addr, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
SPI to I2C i2c read function.
This function reads a desired number of data bytes from the I2C target device.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | slave_addr | : 7-bit target device slave address. |
| [out] | data_out | : Output data read. |
| [in] | len | : Number of bytes to be read. |
>0 - I2C status error, 0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_i2c_read_after_write | ( | spitoi2c_t * | ctx, |
| uint8_t | slave_addr, | ||
| uint8_t * | data_in, | ||
| uint8_t | in_len, | ||
| uint8_t * | data_out, | ||
| uint8_t | out_len ) |
SPI to I2C i2c read after write function.
This function performs a write then read with a repeated start to the I2C target device.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | slave_addr | : 7-bit target device slave address. |
| [in] | data_in | : Data to be written. |
| [in] | in_len | : Number of bytes to be written. |
| [out] | data_out | : Output data read. |
| [in] | out_len | : Number of bytes to be read. |
>0 - I2C status error, 0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_i2c_write | ( | spitoi2c_t * | ctx, |
| uint8_t | slave_addr, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
SPI to I2C i2c write function.
This function writes a desired number of data bytes to the I2C target device.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | slave_addr | : 7-bit target device slave address. |
| [in] | data_in | : Data to be written. |
| [in] | len | : Number of bytes to be written. |
>0 - I2C status error, 0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_i2c_write_after_write | ( | spitoi2c_t * | ctx, |
| uint8_t | slave_addr, | ||
| uint8_t * | data_in1, | ||
| uint8_t | in1_len, | ||
| uint8_t * | data_in2, | ||
| uint8_t | in2_len ) |
SPI to I2C i2c write after write function.
This function performs a write then write with a repeated start to the I2C target device.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | slave_addr | : 7-bit target device slave address. |
| [in] | data_in1 | : Data 1 to be written. |
| [in] | in1_len | : Number of bytes of data 1 to be written. |
| [in] | data_in2 | : Data 2 to be written. |
| [in] | in2_len | : Number of bytes of data 2 to be written. |
>0 - I2C status error, 0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_init | ( | spitoi2c_t * | ctx, |
| spitoi2c_cfg_t * | cfg ) |
SPI to I2C initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See spitoi2c_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void spitoi2c_read_buffer | ( | spitoi2c_t * | ctx, |
| uint8_t * | data_out, | ||
| uint8_t | len ) |
SPI to I2C read buffer function.
This function reads a desired number of data bytes performing a read buffer command.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [out] | data_out | : Output data read. |
| [in] | len | : Number of bytes to be read. |
| err_t spitoi2c_read_i2c_status | ( | spitoi2c_t * | ctx, |
| uint8_t * | i2c_stat ) |
SPI to I2C read i2c status function.
This function reads the I2C status register.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [out] | i2c_stat | : I2C status register data. Refer to I2C Status macro definitions for more details. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_read_register | ( | spitoi2c_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
SPI to I2C read register function.
This function reads data from the specified chip internal register.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | reg | : Chip internal register address. |
| [out] | data_out | : Output data read. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_read_version | ( | spitoi2c_t * | ctx, |
| uint8_t * | version ) |
SPI to I2C read version function.
This function reads the firmware version (16-bytes string ending with a null terminator).
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [out] | version | : Firmware version (16-bytes string ending with a null terminator). |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t spitoi2c_set_spi_config | ( | spitoi2c_t * | ctx, |
| uint8_t | spi_cfg ) |
SPI to I2C set spi config function.
This function sets the spi configuration to MSB or LSB first.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | spi_cfg | : 0x81 - LSB first, 0x42 - MSB first. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void spitoi2c_wake_up | ( | spitoi2c_t * | ctx | ) |
SPI to I2C wake up function.
This function wakes up from deep power down mode by toggling the chip select pin.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| err_t spitoi2c_write_register | ( | spitoi2c_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
SPI to I2C write register function.
This function writes a desired data to the specified chip internal register. the selected register by using SPI serial interface.
| [in] | ctx | : Click context object. See spitoi2c_t object definition for detailed explanation. |
| [in] | reg | : Chip internal register address. |
| [in] | data_in | : Data to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.